home *** CD-ROM | disk | FTP | other *** search
- Include "equ.h"
- Include "impequ.h"
-
- SECTION prowrite,CODE,PUBLIC
- ***************************************************
- *** ***
- ***************************************************
- dumbentry:
- clr.l d0
- rts
-
- dc.l "IMPT"
- dc.w 200
- dc.l 0
-
- table: dc.l 0
- dc.l name,special,check,prowrite
-
- *
- * Excellence Check routine
- *
- check: move.l table,a0
- move.l buff1(a0),a1
- move.l (a1),a1
- cmp.l #"FORM",(a1)
- bne never
- cmp.l #"WORD",8(a1)
- bne never
- moveq #2,d0
- rrts: rts
-
-
- ***
- *** Text File Import
- ***
-
- *
- * ProWrite
- *
- prowrite:
- move.l sp,savesp
-
- move.l table,a0
- move.l f_openr(a0),a0
- jsr (a0)
- beq rrts
-
- move.l table,a0
- move.l t_open(a0),a0
- jsr (a0)
- beq ftxt9
-
- jsr pgetl ;"FORM"
- jsr pgetl
- move.l d0,length
- jsr pgetl ;"WORD"
- sub.l #4,length
-
- clr.b tflag
-
- clr.b newstyle
- move.b #1,readflag
- move.w #1200,curpoint
-
- getchunk:
- jsr pgetl
- move.l d0,temp
- jsr pgetl
- move.l d0,clength
- sub.l #8,length
-
- move.l temp,d0
- lea chunks-4,a0
- move.w #12,d1
- gc1: lea 4(a0),a0
- cmp.l (a0)+,d0
- dbeq d1,gc1
- move.l (a0),a0
- jsr (a0)
- tst.l length
- bne getchunk
-
- ftxt9: jsr tflush
-
- move.l table,a0
- move.l f_closer(a0),a0
- jsr (a0)
- move.l table,a0
- move.l t_close(a0),a0
- jmp (a0)
-
-
- chunks: dc.l "FONT",font
- dc.l "COLR",skip
- dc.l "DOC ",doc
- dc.l "HEAD",head
- dc.l "FOOT",foot
- dc.l "PCTS",skip
- dc.l "PARA",para
- dc.l "TABS",skip
- dc.l "PAGE",skip
- dc.l "TEXT",text
- dc.l "FSCC",fscc
- dc.l "PINF",skip
- dc.l 0,skip
-
-
- ***********************************
- *** ***
- ***********************************
- font: jsr pget ;font number
- move.b d0,temp
- jsr pget ;pad
-
- jsr pgetw ;font size
- mulu #100,d0
- lea pntlist,a0
- moveq #0,d1
- move.b temp,d1
- lsl.w #1,d1
- move.w d0,0(a0,d1.w)
-
- move.l clength,d0
- addq.l #1,d0
- bclr #0,d0
- sub.l d0,length
- subq.l #4,d0
- bra skippy
-
- skippy: tst.l d0
- beq rrts
- move.l d0,-(sp)
- jsr pget
- move.l (sp)+,d0
- sub.l #1,d0
- bra skippy
-
-
- ***********************************
- *** ***
- ***********************************
- doc: bsr tflush
- move.b #1,readflag
- clr.b newstyle
- bra skip
-
- ***********************************
- *** ***
- ***********************************
- head: bsr tflush
- clr.b readflag
- bra skip
-
- ***********************************
- *** ***
- ***********************************
- foot: bsr tflush
- clr.b readflag
- bra skip
-
- ***********************************
- *** ***
- ***********************************
- para: bsr tflush
- tst.b readflag
- beq skip
-
- clr.b newstyle
-
- move.w #CMD_PIN,d0 ;paragraph indent
- bsr tputw
- bsr pgetw ;indent
- move.w d0,temp
- bsr pgetw ;left margin
- sub.w temp,d0
- neg.w d0
- muls #10,d0
- bsr tputw
- bsr pgetw ;right margin
-
-
- move.w #CMD_LSP,d0 ;line spacing
- bsr tputw
- bsr pget
- and.w #$ff,d0
- lsr.w #4,d0
- addq.w #1,d0
- mulu curpoint,d0
- bsr tputw
-
- move.w #CMD_JST,d0 ;justification
- bsr tputw
- bsr pget
- bsr tput
-
- bsr pget ;font number
- lea pntlist,a0
- and.w #$ff,d0
- lsl.w #1,d0
- move.w 0(a0,d0.w),curpoint
- move.w 0(a0,d0.w),parapoint
- move.w #CMD_PT,d0
- jsr tputw
- moveq #0,d0
- move.w curpoint,d0
- jsr tputl
- moveq #0,d0
- move.w curpoint,d0
- jsr tputl
-
- move.w #CMD_AT,d0 ;style
- jsr tputw
- bsr pget
- moveq #0,d1
- btst #0,d0
- beq newa1
- bset #UNDER,d1
- newa1: btst #1,d0
- beq newa2
- bset #BOLD,d1
- newa2: btst #2,d0
- beq newa3
- bset #ITALICS,d1
- newa3: move.l d1,d0
- move.w d0,parastyle
- jsr tputl
-
- move.w #CMD_BMOD,d0 ;super/sub
- bsr tputw
- bsr pget
- moveq #0,d1
- cmp.b #1,d0
- bne para1
- move.w curpoint,d1
- lsr.w #1,d1
- para1: cmp.b #2,d0
- bne para2
- move.w curpoint,d1
- lsr.w #1,d1
- neg.w d1
- para2: move.w d1,d0
- move.w d0,parabmod
- bsr tputw
-
- bsr pget ;color
- bsr pgetl ;pad
-
- bra adjlen
-
- ***********************************
- *** ***
- ***********************************
- text: bsr tflush
- tst.b readflag
- beq skip
-
- tst.b newstyle
- beq text0
- clr.b newstyle
- move.w #CMD_PT,d0
- bsr tputw
- moveq #0,d0
- move.w parapoint,d0
- bsr tputl
- moveq #0,d0
- move.w parapoint,d0
- bsr tputl
- move.w #CMD_AT,d0
- bsr tputw
- moveq #0,d0
- move.w parastyle,d0
- bsr tputl
- move.w #CMD_BMOD,d0
- bsr tputw
- move.w parabmod,d0
- bsr tputw
-
- text0:
-
- move.l clength,d0
- clr.w d1
- clr.w d2
- move.l table,a1
- move.l m_alloc(a1),a1
- jsr (a1)
- move.l a0,thandle
- move.b #1,tflag
-
- move.l clength,temp
- clr.l tlength
- clr.l toffset
- bra text3
- text1: jsr pget
- tst.b d0
- bne text2
- moveq #1,d0
- text2: jsr qput
- text3: subq.l #1,temp
- bcc text1
-
- bra adjlen
-
-
- qput: move.l thandle,a0
- move.l (a0),a0
- add.l tlength,a0
- move.b d0,(a0)
- addq.l #1,tlength
- rts
-
-
-
- tflush: tst.b tflag
- beq rrts
- clr.b tflag
- clr.l temp
- clr.w count
- bra tf9
- tf1: move.l thandle,a0
- move.l (a0),a0
- add.l temp,a0
- move.b (a0),d0
- tst.w count
- beq tf3
- subq.w #1,count
- bra tf8
- tf3: tst.b d0
- bne tf7
- moveq #0,d1
- move.b 1(a0),d1
- move.l table,a1
- move.l cmdlength(a1),a1
- move.b 0(a1,d1.w),d1
- addq.w #1,d1
- move.w d1,count
- bra tf8
- tf7: cmp.b #$9,d0
- beq txttab
- and.w #$ff,d0
- lea ktoi,a0
- move.b 0(a0,d0.w),d0
- beq tf10
- bra tf8
- txttab: move.w #CMD_TAB,d0
- bsr tputw
- bra tf10
- tf8: bsr tput
- tf10: addq.l #1,temp
- tf9: subq.l #1,tlength
- bcc tf1
-
- move.w #CMD_CR,d0
- bsr tputw
-
- move.l thandle,a0
- move.l table,a1
- move.l m_delete(a1),a1
- jsr (a1)
- rts
-
- ***********************************
- *** ***
- ***********************************
- fscc: tst.b readflag
- beq skip
- tst.b tflag
- beq skip
-
- topfscc:
- move.b #1,newstyle
- move.l table,a1
- move.l m_grow(a1),a1
- move.l thandle,a0
- move.l #20,d0
- jsr (a1)
- add.l #20,tlength
-
- bsr pgetw ;TEXT chunk byte offset for change
- and.l #$ffff,d0
- add.l toffset,d0
- move.l d0,temp
- add.l #20,toffset
- move.l thandle,a0
- move.l (a0),a0
- move.l a0,a1
- add.l d0,a0
- add.l tlength,a1
- move.l a1,a2
- sub.l #20,a2
- fscc0: move.b -(a2),-(a1)
- cmp.l a0,a2
- bhi fscc0
-
- bsr pget ;font number (point size - 6)
- lea pntlist,a0
- and.w #$ff,d0
- lsl.w #1,d0
- move.w 0(a0,d0.w),curpoint
- move.w #CMD_PT,d0
- jsr sputw
- moveq #0,d0
- move.w curpoint,d0
- jsr sputl
- moveq #0,d0
- move.w curpoint,d0
- jsr sputl
-
- move.w #CMD_AT,d0 ;style (4)
- jsr sputw
- bsr pget
- moveq #0,d1
- btst #0,d0
- beq fscc1
- bset #UNDER,d1
- fscc1: btst #1,d0
- beq fscc2
- bset #BOLD,d1
- fscc2: btst #2,d0
- beq fscc3
- bset #ITALICS,d1
- fscc3: move.l d1,d0
- jsr sputl
-
- move.w #CMD_BMOD,d0 ;super/sub (4)
- bsr sputw
- bsr pget
- moveq #0,d1
- cmp.b #1,d0
- bne fscc7
- move.w curpoint,d1
- lsr.w #1,d1
- fscc7: cmp.b #2,d0
- bne fscc8
- move.w curpoint,d1
- lsr.w #1,d1
- neg.w d1
- fscc8: move.w d1,d0
- bsr sputw
-
- bsr pget ;color
-
- bsr pgetw ;pad
-
- sub.l #8,length
- sub.l #8,clength
- bhi topfscc
- rts
-
-
- sputl: move.l thandle,a0
- move.l (a0),a0
- add.l temp,a0
-
- move.b d0,3(a0)
- lsr.l #8,d0
- move.b d0,2(a0)
- lsr.l #8,d0
- move.b d0,1(a0)
- lsr.l #8,d0
- move.b d0,(a0)
-
- addq.l #4,temp
- rts
-
- sputw: move.l thandle,a0
- move.l (a0),a0
- add.l temp,a0
- move.b d0,1(a0)
- lsr.w #8,d0
- move.b d0,(a0)
- addq.l #2,temp
- rts
-
- sput: move.l thandle,a0
- move.l (a0),a0
- add.l temp,a0
- move.b d0,(a0)
- addq.l #1,temp
- rts
-
-
- ***********************************
- *** ***
- ***********************************
- adjlen: move.l clength,d0
- btst #0,d0
- beq al1
- jsr pget
- move.l clength,d0
- add.l #1,d0
-
- al1: sub.l d0,length
- rts
-
-
- ***********************************
- *** ***
- ***********************************
- skip: move.l clength,d0
- add.l #1,d0
- bclr #0,d0
- sub.l d0,length
-
- sk1: tst.l d0
- beq rrts
- move.l d0,-(sp)
- jsr pgetw
- move.l (sp)+,d0
- sub.l #2,d0
- bra sk1
-
- ***********************************
- *** ***
- ***********************************
- errrts: move.l savesp,sp
-
- move.l table,a0
- move.l f_closer(a0),a0
- jsr (a0)
-
- move.l table,a0
- move.l t_close(a0),a0
- jmp (a0)
-
-
- ***********************************
- *** ***
- ***********************************
- pgetl: move.l table,a0
- move.l f_getl(a0),a0
- jsr (a0)
- beq errrts
- rts
-
- pgetw: move.l table,a0
- move.l f_getw(a0),a0
- jsr (a0)
- beq errrts
- rts
-
- pget: move.l table,a0
- move.l f_get(a0),a0
- jsr (a0)
- beq errrts
- rts
-
- tputw: move.l table,a0
- move.l t_putw(a0),a0
- jsr (a0)
- beq errrts
- rts
-
- tputl: move.l table,a0
- move.l t_putl(a0),a0
- jsr (a0)
- beq errrts
- rts
-
- tput: move.l table,a0
- move.l t_put(a0),a0
- jsr (a0)
- beq errrts
- rts
-
- *******************************************************************
- *** called when the import routine choosen finds something ***
- *** wrong with the file loaded. ***
- *******************************************************************
- notright:
- rts
-
- never: moveq #0,d0
- rts
-
- maybe: moveq #1,d0
- rts
-
- right: moveq #2,d0
- rts
-
- ***********************************************************
- *** ***
- ***********************************************************
- SECTION prowrite,DATA,PUBLIC
-
- ktoi: dc.b $00,$00,$00,$00,$00,$00,$00,$00 ;$00-$07
- dc.b $00,$00,$00,$00,$00,$00,$00,$00 ;$08-$0f
- dc.b $00,$00,$00,$00,$00,$00,$00,$00 ;$10-$17
- dc.b $00,$00,$00,$00,$00,$00,$00,$00 ;$18-$1f
- dc.b $20,$21,$22,$23,$24,$25,$26,$27
- dc.b $28,$29,$2a,$2b,$2c,$2d,$2e,$2f
- dc.b $30,$31,$32,$33,$34,$35,$36,$37
- dc.b $38,$39,$3a,$3b,$3c,$3d,$3e,$3f
- dc.b $40,$41,$42,$43,$44,$45,$46,$47
- dc.b $48,$49,$4a,$4b,$4c,$4d,$4e,$4f
- dc.b $50,$51,$52,$53,$54,$55,$56,$57
- dc.b $58,$59,$5a,$5b,$5c,$5d,$5e,$5f
- dc.b $60,$61,$62,$63,$64,$65,$66,$67
- dc.b $68,$69,$6a,$6b,$6c,$6d,$6e,$6f
- dc.b $70,$71,$72,$73,$74,$75,$76,$77
- dc.b $78,$79,$7a,$7b,$7c,$7d,$7e,$00
-
- dc.b 000,000,000,000,000,000,000,000 ;$80
- dc.b 000,000,000,000,000,000,000,000 ;$88
- dc.b 000,000,000,000,000,000,000,000 ;$90
- dc.b 000,000,000,000,000,000,000,000 ;$98
- dc.b 000,186,162,163,160,161,142,165 ;$a0
- dc.b 000,183,188,136,141,173,184,129 ;$a8
- dc.b 155,140,148,149,166,153,181,172 ;$b0
- dc.b 000,147,156,137,144,145,146,185 ;$b8
- dc.b 192,193,194,195,196,197,198,199 ;$c0
- dc.b 200,201,202,203,204,205,206,207 ;$c8
- dc.b 157,209,210,211,212,213,214,138 ;$d0
- dc.b 159,217,218,219,220,221,158,187 ;$d8
- dc.b 224,225,226,227,228,229,230,231 ;$e0
- dc.b 232,233,234,235,236,237,238,239 ;$e8
- dc.b 189,241,242,243,244,245,246,139 ;$f0
- dc.b 191,249,250,251,252,253,190,254 ;$f8
-
- special:
- dc.w 1
- dc.l spcl1
- *
- name: dc.b "ProWrite v2.0.2",0
- *
- spcl1: dc.b "Formatted Text",0
- *
-
-
- *
-
- SECTION prowrite,BSS,PUBLIC
- savesp: ds.l 1
- clength: ds.l 1
- length: ds.l 1
- temp: ds.l 1
- thandle: ds.l 1
- tlength: ds.l 1
- toffset: ds.l 1
- pntlist: ds.w 256
- parapoint: ds.w 1
- parastyle: ds.w 1
- parabmod: ds.w 1
- count: ds.w 1
- curpoint: ds.w 1
- newstyle: ds.b 1
- readflag: ds.b 1
- tflag: ds.b 1
- ds.b 1
-